/**
 * @fileoverview Description of file, its uses and information
 * about its dependencies.
 *
 * @author author@google.com (Firstname Lastname)
 * https://www.corp.google.com/eng/doc/javascriptguide.xml
 */
// (function (window, undefined) {
//   acey.


  
// })(this);


// $(document).ready(function() {
  

//   	var table_ad_scheduling = {
// 	  	"headers": [
// 	  		{"id": "Campaign", "title": "Campaign"}, 
// 	  		{"id": "DayAndTime", "title": "Day and time"}, 
// 	  		{"id": "BidAdj", "title": "Bid adj"}, 
// 	  		{"id": "Clicks", "title": "Clicks"}, 
// 	  		{"id": "Impr", "title": "Impr."}, 
// 	  		{"id": "CTRAvg", "title": "CTR"}, 
// 	  		{"id": "CPC", "title": "Avg. CPC"}, 
// 	  		{"id": "Cost", "title": "Cost"}, 
// 	  		{"id": "AvgPos", "title": "Avg. Pos."}, 
// 	  		{"id": "Conv", "title": "Conv. rate (1-per-click)"}, 
// 	  		{"id": "CostConv", "title": "Cost / conv. (1-per-click)"}, 
// 	  		{"id": "ConvRate", "title": "Conv. rate (1-per-click)"}, 
// 	  		{"id": "ViewThroughConv", "title": "View-through conv."}
// 		], 
// 		"rows": [
// 			{"Impr": 3598, "AvgPos": "1.3", "ViewThroughConv": "2", "ConvRate": "6.72%", "Conv": 5, "Campaign": "Campaign #1", "CPC": "$2.00", "BidAdj": "--", "Cost": "$23.00", "CTRAvg": "4.5%", "DayAndTime": "Monday, 06:00 AM - 09:00 PM", "Clicks": 10, "CostConv": "$2.00"}, 
// 			{"Impr": 5598, "AvgPos": "1.3", "ViewThroughConv": "2", "ConvRate": "6.72%", "Conv": 4, "Campaign": "Campaign #2 very very long name", "CPC": "$2.00", "BidAdj": "--", "Cost": "$23.00", "CTRAvg": "4.5%", "DayAndTime": "Tuesday, 06:00 AM - 09:00 PM", "Clicks": 200, "CostConv": "$2.00"}, 
// 			{"Impr": 10598, "AvgPos": "1.3", "ViewThroughConv": "2", "ConvRate": "6.72%", "Conv": 2, "Campaign": "Campaign #3", "CPC": "$2.00", "BidAdj": "--", "Cost": "$23.00", "CTRAvg": "4.5%", "DayAndTime": "Wednesday, 06:00 AM - 09:00 PM", "Clicks": 40, "CostConv": "$2.00"}, 
// 			{"Impr": 9598, "AvgPos": "1.3", "ViewThroughConv": "2", "ConvRate": "6.72%", "Conv": 3, "Campaign": "Campaign #4", "CPC": "$2.00", "BidAdj": "--", "Cost": "$23.00", "CTRAvg": "4.5%", "DayAndTime": "Thursday, 06:00 AM - 09:00 PM", "Clicks": 160, "CostConv": "$2.00"}, 
// 			{"Impr": 2598, "AvgPos": "1.3", "ViewThroughConv": "2", "ConvRate": "6.72%", "Conv": 9, "Campaign": "Campaign #5", "CPC": "$2.00", "BidAdj": "--", "Cost": "$23.00", "CTRAvg": "4.5%", "DayAndTime": "Friday, 06:00 AM - 09:00 PM", "Clicks": 80, "CostConv": "$2.00"}
// 		]};

//   var initSortable = function() {
  	
//   	$( '.sortable' ).sortable();
//   	$( '.sortable' ).disableSelection();
//   };

//   $('#show_reorder_dialog').click(function() {
//   	initSortable();		
//   })

// })
angular.module("acey").directive('ngBlur', ['$parse', function($parse) {
  return function(scope, element, attr) {
    var fn = $parse(attr['ngBlur']);
    element.bind('blur', function(event) {
      scope.$apply(function() {
        fn(scope, {$event:event});
      });
    });
  }
}]);
function TableCtrl($scope) {
	
}
function UxDataTableCtrl($scope) {
	$scope.name = 'name';
	// $scope.rows = data.table_ad_scheduling.rows;
	$scope.rows = [
			{"Impr": 3598, "AvgPos": "1.3", "ViewThroughConv": "2", "ConvRate": "6.72%", "Conv": 5, "Campaign": "Campaign #1", "CPC": "$2.00", "BidAdj": "--", "Cost": "$23.00", "CTRAvg": "4.5%", "DayAndTime": "Monday, 06:00 AM - 09:00 PM", "Clicks": 10, "CostConv": "$2.00"}, 
			{"Impr": 5598, "AvgPos": "1.3", "ViewThroughConv": "2", "ConvRate": "6.72%", "Conv": 4, "Campaign": "Campaign #2 very very long name", "CPC": "$2.00", "BidAdj": "--", "Cost": "$23.00", "CTRAvg": "4.5%", "DayAndTime": "Tuesday, 06:00 AM - 09:00 PM", "Clicks": 200, "CostConv": "$2.00"}, 
			{"Impr": 10598, "AvgPos": "1.3", "ViewThroughConv": "2", "ConvRate": "6.72%", "Conv": 2, "Campaign": "Campaign #3", "CPC": "$2.00", "BidAdj": "--", "Cost": "$23.00", "CTRAvg": "4.5%", "DayAndTime": "Wednesday, 06:00 AM - 09:00 PM", "Clicks": 40, "CostConv": "$2.00"}, 
			{"Impr": 9598, "AvgPos": "1.3", "ViewThroughConv": "2", "ConvRate": "6.72%", "Conv": 3, "Campaign": "Campaign #4", "CPC": "$2.00", "BidAdj": "--", "Cost": "$23.00", "CTRAvg": "4.5%", "DayAndTime": "Thursday, 06:00 AM - 09:00 PM", "Clicks": 160, "CostConv": "$2.00"}, 
			{"Impr": 2598, "AvgPos": "1.3", "ViewThroughConv": "2", "ConvRate": "6.72%", "Conv": 9, "Campaign": "Campaign #5", "CPC": "$2.00", "BidAdj": "--", "Cost": "$23.00", "CTRAvg": "4.5%", "DayAndTime": "Friday, 06:00 AM - 09:00 PM", "Clicks": 80, "CostConv": "$2.00"}
		];
	$scope.updateId = function(i, id) {
		// i.id = id;
		if (i.testid)
			console.log('update id ' + i.testid.id + ' to ' + id);
		i.testid = {'id': id}
		
		
	}	
	$scope.print = function() {
		console.log('test')
	}
	$scope.setDisplayId = function(i) {
		return i.testid.id;
	}
	
}
